package br.com.sfs.ejb.entity;

import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


@Entity
@Table(name="usuario")
@NamedQueries({
	@NamedQuery(name="Usuario.consultarPorEmail", query="select u from Usuario u where u.email =:email "),
	@NamedQuery(name="Usuario.consultarTodos", query="select u from Usuario u ")
})
public class Usuario {
	
	@Id
	@Column(name="idUsuario")
	@SequenceGenerator(name="idUsuario", sequenceName="idUsuario", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE)
	private Long idUsuario;
	@Column(name="email", length=255)
	private String email;
	@Column(name="senha", length=255)
	private String senha;
	@Column(name="nome", length=255)
	private String nome;
	@Column(name="cargo", length=255)
	private String cargo;
	@Column(name="celula", length=255)
	private String celula;
	
	
	//-----------------------------------------------------------//
	
	public Long getIdUsuario() {
		return idUsuario;
	}
	public void setIdUsuario(Long idUsuario) {
		this.idUsuario = idUsuario;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getSenha() {
		return senha;
	}
	public void setSenha(String senha) {
		this.senha = senha;
	}
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}
	public String getCargo() {
		return cargo;
	}
	public void setCargo(String cargo) {
		this.cargo = cargo;
	}
	public String getCelula() {
		return celula;
	}
	public void setCelula(String celula) {
		this.celula = celula;
	}
	
	public Collection<Postagem> getPostagens() {
		return postagens;
	}
	public void setPostagens(Collection<Postagem> postagens) {
		this.postagens = postagens;
	}

	@OneToMany(mappedBy="usuario", fetch = FetchType.LAZY)
	
	private Collection<Postagem> postagens;
}
